<script type="text/javascript">
    var status = '<?php echo $_GET['status'];?>';
    if(status == '-1'){
        alert('fail:<?php echo $_GET['msg'];?>');
    }
    $("#beautify_edit").on("hidden.bs.modal", function() {
        $(this).removeData("bs.modal");
    });
    function on_submit(){
        var start_time = $("#start_time").val();
        var end_time = $("#end_time").val();
        var like_num_min = parseInt($("#like_num_min").val());
        var like_num_max = parseInt($("#like_num_max").val());
        var play_num_min = parseInt($("#play_num_min").val());
        var play_num_max = parseInt($("#play_num_max").val());
        if(!start_time || !end_time || !like_num_min || !like_num_max || !play_num_min || !play_num_max){
            alert('用户类型, 周期范围，点赞范围，播放量范围 不能为空');
            return false;
        }
        if(like_num_min >= like_num_max){
            alert('最小点赞数 必须 小于最大点赞数');
            return false;
        }
        if(play_num_min >= play_num_max){
            alert('最小播放量 必须 小于最大播放量');
            return false;
        }
        if(play_num_min < like_num_max){
            alert('最小播放量 必须 大于最大点赞数');
            return false;
        }

        $("#beautify_form").submit();
    }
</script>

<div class="tab-pane active" id="horizontal-form">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true" aria-label="Close">×</button>
        <h5 class="modal-title"><?php echo $pageTitle;?></h5>
    </div>

    <form class="form-horizontal" id="beautify_form" action="index.php?c=<?php echo $_REQUEST['c'];?>&m=<?php echo $_REQUEST['m'];?>" name="form" method="post" enctype="multipart/form-data">
        <input type="hidden" name="id" id="id" value="<?php echo $id; ?>"/>
        <input type="hidden" name="submits" value="1"/>


        <div class="form-group" style="margin-top: 10px;">
            <label for="fan_time" class="col-sm-2 control-label">周期范围</label>
            <div class="col-sm-6">
                <input type="text" name="param[start_time]" value="<?php echo $beautify["start_time"]; ?>" class="form-control col-sm-2" id="start_time" placeholder="开始分钟" style="width: 100px">
                <input type="text" name="param[end_time]" value="<?php echo $beautify["end_time"]; ?>" class="form-control col-sm-2" id="end_time" placeholder="结束分钟" style="width: 100px;margin-left: 20px;">
            </div>
        </div>

        <div class="form-group" style="margin-top: 10px;">
            <label for="like_num" class="col-sm-2 control-label">点赞范围</label>
            <div class="col-sm-6">
                <input type="text" name="param[like_num_min]" value="<?php echo $beautify["like_num_min"]; ?>" class="form-control col-sm-2" id="like_num_min" placeholder="最小点赞数" style="width: 100px">
                <input type="text" name="param[like_num_max]" value="<?php echo $beautify["like_num_max"]; ?>" class="form-control col-sm-2" id="like_num_max" placeholder="最大点赞数" style="width: 100px;margin-left: 20px;">
            </div>
        </div>

        <div class="form-group" style="margin-top: 10px;">
            <label for="play_num" class="col-sm-2 control-label">播放量范围</label>
            <div class="col-sm-6">
                <input type="text" name="param[play_num_min]" value="<?php echo $beautify["play_num_min"]; ?>" class="form-control col-sm-2" id="play_num_min" placeholder="最小播放量" style="width: 100px">
                <input type="text" name="param[play_num_max]" value="<?php echo $beautify["play_num_max"]; ?>" class="form-control col-sm-2" id="play_num_max" placeholder="最大播放量" style="width: 100px;margin-left: 20px;">
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-4 col-sm-offset-2">
                <input type="button" onclick="on_submit()" name="btn" value="保存" class="btn btn-primary" />
                <input type="reset" name="reset" value="取消" class="btn btn-default"/>
            </div>
        </div>

    </form>
</div>

